require 'migration_helpers'

class CreateCoursesSessions < ActiveRecord::Migration
  extend MigrationHelper::ForeignKeys
  
  def self.up
    create_table :courses_sessions do |t|
      t.column :session_id, :integer
      t.column :course_id,  :integer
      t.column :teacher_id, :integer
      t.column :created_at, :date
      t.column :updated_at, :date
    end
    
    add_foreign_key(:courses_sessions, :session_id, :sessions)
    add_foreign_key(:courses_sessions, :course_id, :courses)
    add_foreign_key(:courses_sessions, :teacher_id, :teachers)
  end

  def self.down
    drop_table :courses_sessions
  end
end
